Imports CapaDeDatos
Public Class nCuenta
    Public Cuenta As CapaDeDatos.dCuenta = New CapaDeDatos.dCuenta
    Public Banco As CapaDeDatos.dBanco = New CapaDeDatos.dBanco
    Public Function InsertarCuenta(ByVal NumeroCuenta As String, ByVal Tipo As String, ByVal CodigoBanco As Integer, ByVal Chequera As String) As Boolean
        Return Cuenta.Insertar(NumeroCuenta, Tipo, CodigoBanco, Chequera)
    End Function
    Public Function ModificarCuenta(ByVal CodigoCuenta As Integer, ByVal NumeroCuenta As String, ByVal Tipo As String, ByVal CodigoBanco As Integer, ByVal Chequera As String) As Boolean
        Return Cuenta.Modificar(CodigoCuenta, NumeroCuenta, Tipo, CodigoBanco, Chequera)
    End Function
    Public Function EliminarCuenta(ByVal CodigoCuenta As Integer) As Boolean
        Return cuenta.Eliminar(CodigoCuenta)
    End Function
    Public Function ListarCuenta(ByVal CodigoCuenta As Integer, ByVal NumeroCuenta As String, ByVal Tipo As String, ByVal CodigoBanco As Integer, ByVal Chequera As String) As DataSet
        Return Cuenta.BuscarFiltrado(CodigoCuenta, NumeroCuenta, Tipo, CodigoBanco, Chequera)
    End Function
    Public Function DarBanco(ByVal CodigoCuenta As Integer, ByVal Codigobanco As Integer) As Integer
        Return Cuenta.DarBanco(CodigoCuenta, Codigobanco)
    End Function
    Public Function ListarTodos(ByVal CodigoCuenta As Integer, ByVal NumeroCuenta As String, ByVal Tipo As String, ByVal CodigoBanco As Integer, ByVal Chequera As String) As DataSet
        Dim dtsPrincipal As DataSet
        dtsPrincipal = Cuenta.BuscarFiltrado(CodigoCuenta, "", Tipo, CodigoBanco, Chequera)
        dtsPrincipal.Tables(0).Columns.Add("Denominacion")
        Dim i As Integer
        For i = 0 To dtsPrincipal.Tables(0).Rows.Count - 1
            Try
                dtsPrincipal.Tables(0).Rows(i)("Denominacion") = Banco.BuscarFiltrado(dtsPrincipal.Tables(0).Rows(i)("CodigoBanco").ToString(), "", "").Tables(0).Rows(0)("Denominacion").ToString()
            Catch ex As Exception
                dtsPrincipal.Tables(0).Rows(i)("Denominacion") = "Error,Banco no Encontrado"
            End Try
        Next
        Return dtsPrincipal
    End Function
End Class
